package com.chj.design.sk;

//https://blog.csdn.net/rocketeerLi/article/details/81745034
public class Code06_Prototype {
	public static class Apple implements Cloneable {
		public void say() {
			System.out.println("我是苹果...");
		}

		@Override
		public Apple clone() {
			Apple apple = null;
			try {
				apple = (Apple) super.clone();
			} catch (CloneNotSupportedException e) {
				System.out.println("拷贝失败!!!");
			}
			return apple;
		}
	}

	public static void main(String[] args) {
		Apple apple1 = new Apple();
		apple1.say();
		Apple apple2 = apple1.clone();
		apple2.say();
	}
}
